package com.yc.ycbook.common.ui

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.yc.ycbook.R
import com.yc.ycbook.base.BaseActivity
import com.yc.ycbook.read.fragment.ReadMainFragment

/**
 * 主页
 */
class MainActivity : BaseActivity() {
    companion object {
        fun newInstance(activity: AppCompatActivity) {
            activity.startActivity(Intent(activity, MainActivity::class.java))
        }
    }

    override fun getLayoutId(): Int {
        return R.layout.activity_main
    }

    override fun initView(savedInstanceState: Bundle?) {
        val fragment = ReadMainFragment.newInstance()
        val trx = supportFragmentManager.beginTransaction()
        trx.hide(fragment)
        if (!fragment.isAdded) {
            trx.add(R.id.mainFl, fragment)
        }
        trx.show(fragment).commit()
    }
}
